namespace test12
{
    public partial class Form1 : Form
    {
        OrderService os;
        private BindingSource binding1;
        public Form1()
        {
            InitializeComponent();
            this.os = new OrderService();
            //binding1.DataSource = os.data;

        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            new Form2(os,1).ShowDialog();

        }

        private void button2_Click(object sender, EventArgs e)
        {
            os.DeleteOrder(int.Parse(textBox1.Text));
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {

        }

        private void button3_Click(object sender, EventArgs e)
        {
            new Form2(os,2).ShowDialog();
        }

        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            
            Object o = dataGridView1.Rows[e.RowIndex].DataBoundItem;
            int row = e.RowIndex;
            //foreach (object i in os.data)
            //{
            //    if (o == i)
            //    {
            //        Order order = (Order)o;

            //    }
            //}
        }


        private void button4_Click(object sender, EventArgs e)
        {
            int t = int.Parse(textBox2.Text);
            dataGridView1.DataSource = os.SearchOrderByOrderNum(t);

        }
    }
}